package com.chendx.store.user.controller;

import com.chendx.model.common.dtos.ResponseResult;
import com.chendx.model.user.dto.RegisterDto;
import com.chendx.store.api.user.RegisterControllerApi;
import com.chendx.store.user.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by chendx on 2022/4/27.
 */
@RestController
@RequestMapping("/api/register")
public class RegisterController implements RegisterControllerApi {

    @Autowired
    private RegisterService registerService;

    @Override
    @PostMapping("/register_auth")
    public ResponseResult register(@RequestBody RegisterDto dto) {
        return registerService.register(dto);
    }

    @Override
    @GetMapping("/exist_phone")
    public ResponseResult existPhone(String phone) {
        return registerService.existPhone(phone);
    }

    @Override
    @GetMapping("/exist_name")
    public ResponseResult existName(String name) {
        return registerService.existName(name);
    }
}
